#include <stdio.h>
int main(void)
{
    int i, q, n, j;
    int a[6][6];
    scanf("%d", &n);

    for (i = 0; i < n; i++)
        for (j = 0; j < n; j++)
        {
            scanf("%d", &q);
            a[i][j] = q;
        }
    
    q = 1;
    for (i = 1; i < n; i++)
        for (j = 0; j < i; j++)
            if (a[i][j] != 0)
                q = 0;
    
    if (q)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    return 0;
}